"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[7387],{84560:(e,t,o)=>{o.d(t,{Z:()=>c});var n=o(69307),r=o(70444);const c=(0,n.createElement)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(r.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"}))},56159:(e,t,o)=>{o.d(t,{_$:()=>b,U_:()=>h,b:()=>u});var n=o(69307),r=o(65736),c=o(55609),a=o(9818),i=o(75606),l=o(46530),s=o(51393),d=o(74693);const u=e=>{let{onClick:t}=e;const{showCesModal:o}=(0,a.useDispatch)(i.STORE_KEY),{isDescendantOf:u}=(0,l.useLayoutContext)();return(0,n.createElement)(c.MenuItem,{onClick:()=>{o({action:"new_product",showDescription:!1,title:(0,r.__)("What do you think of the new product form?","woocommerce"),firstQuestion:(0,r.__)("The product editing screen is easy to use","woocommerce"),secondQuestion:(0,r.__)("The product editing screen's functionality meets my needs","woocommerce"),onsubmitLabel:(0,r.__)("Thanks for the feedback — we'll put it to good use!","woocommerce"),getExtraFieldsToBeShown:(e,t,o)=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(c.BaseControl,{id:"feedback_additional_thoughts",className:"woocommerce-product-feedback__additional-thoughts",label:(0,n.createInterpolateElement)((0,r.__)("ADDITIONAL THOUGHTS <optional />","woocommerce"),{optional:(0,n.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,r.__)("(OPTIONAL)","woocommerce"))})},(0,n.createElement)(c.TextareaControl,{value:e.additional_thoughts||"",onChange:o=>t({...e,additional_thoughts:o}),help:(null==o?void 0:o.additional_thoughts)||""})),(0,n.createElement)(c.BaseControl,{id:"feedback_email",className:"woocommerce-product-feedback__email",label:(0,n.createInterpolateElement)((0,r.__)("YOUR EMAIL ADDRESS <optional />","woocommerce"),{optional:(0,n.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,r.__)("(OPTIONAL)","woocommerce"))})},(0,n.createElement)(c.TextControl,{value:e.email||"",onChange:o=>t({...e,email:o}),help:(null==o?void 0:o.email)||""}),(0,n.createElement)("span",null,(0,r.__)("In case you want to participate in further discussion and future user research.","woocommerce")))),validateExtraFields:e=>{let{email:t="",additional_thoughts:o=""}=e;const n={};return t.length>0&&!(0,s.isValidEmail)(t)&&(n.email=(0,r.__)("Please enter a valid email address.","woocommerce")),(null==o?void 0:o.length)>500&&(n.additional_thoughts=(0,r.__)("Please enter no more than 500 characters.","woocommerce")),n}},{shouldShowComments:()=>!1},{type:"snackbar"},{block_editor:u("product-block-editor")}),t()},icon:(0,n.createElement)(d.A,null),iconPosition:"right"},(0,r.__)("Share feedback","woocommerce"))};var m=o(74617),p=o(67221),_=o(73463);const h=e=>{let{onClick:t,productId:o}=e;const{showProductMVPFeedbackModal:l}=(0,a.useDispatch)(i.STORE_KEY),{allowTracking:s,resolving:d}=(0,a.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(p.OPTIONS_STORE_NAME);return{allowTracking:"yes"===(t(i.ALLOW_TRACKING_OPTION_NAME)||"no"),resolving:!o("getOption",[i.ALLOW_TRACKING_OPTION_NAME])}})),u=(0,_.O3)("_feature_nonce"),h=o?(0,m.getAdminLink)(`post.php?post=${o}&action=edit&product_block_editor=0&_feature_nonce=${u}`):(0,m.getAdminLink)(`post-new.php?post_type=product&product_block_editor=0&_feature_nonce=${u}`);return d?null:(0,n.createElement)(c.MenuItem,{onClick:function(){s?l():window.location.href=h,t()},info:(0,r.__)("Save changes and go back to the classic product editing screen.","woocommerce")},(0,r.__)("Turn off the new product form","woocommerce"))};var g=o(23374),w=o(84560),E=o(90495),f=o(65545);const b=e=>{let{onClick:t=(()=>null),onCloseGuide:o}=e;const[a,i]=(0,n.useState)(!1),{isNewUser:l}=(0,f.E)();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(c.MenuItem,{onClick:()=>{i(!0),t()},icon:(0,n.createElement)(g.Z,{icon:w.Z}),iconPosition:"right"},(0,r.__)("About the form…","woocommerce")),a&&(0,n.createElement)(E.Z,{isNewUser:l,onCloseGuide:()=>{i(!1),o()}}))}},30985:(e,t,o)=>{o.r(t),o.d(t,{default:()=>y});var n=o(69307),r=o(51393),c=o(14599),a=o(55609),i=o(85597),l=o(9818),s=o(65736),d=o(98817),u=o(46530),m=o(37798),p=o(56159);const _=e=>{let{onClose:t}=e;const[o]=(0,m.useEntityProp)("postType","product","id"),{type:r,status:i}=(0,l.useSelect)((e=>{const{getEntityRecord:t}=e("core");return t("postType","product",o)}),[o]),d=e=>{(0,c.recordEvent)("product_dropdown_option_click",{selected_option:e,product_type:r,product_status:i})};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(a.MenuGroup,{label:(0,s.__)("New product form (Beta)","woocommerce")},(0,n.createElement)(p._$,{onClick:()=>{d("about")},onCloseGuide:()=>{t()}}),(0,n.createElement)(p.b,{onClick:()=>{d("feedback"),t()}})),(0,n.createElement)(a.MenuGroup,null,(0,n.createElement)(p.U_,{productId:o,onClick:()=>{d("classic_editor"),t()}})))},h=()=>{const[e]=(0,m.useEntityProp)("postType","product","id");return(0,n.createElement)(r.__experimentalProductMVPFeedbackModalContainer,{productId:e})};(0,d.registerPlugin)("wc-admin-more-menu",{scope:"woocommerce-product-block-editor",render:()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(r.__experimentalWooProductMoreMenuItem,null,(e=>{let{onClose:t}=e;return(0,n.createElement)(_,{onClose:t})})),(0,n.createElement)(u.WooHeaderItem,{name:"product"},(0,n.createElement)(h,null)))});var g=o(86020),w=o(90495),E=o(65545);const f=e=>{let{shouldTourBeShown:t,dismissModal:o}=e;const{isNewUser:a,loadingPublishedProductsCount:i}=(0,E.E)();(0,n.useEffect)((()=>{t&&(0,c.recordEvent)("block_product_editor_spotlight_view")}),[t]);const[l,d]=(0,n.useState)(!1),{maybeShowFeedbackBar:u}=(0,r.__experimentalUseFeedbackBar)();if(i)return null;if(l)return(0,n.createElement)(w.Z,{isNewUser:a,onCloseGuide:(e,t)=>{o(),"finish"===t?(0,c.recordEvent)("block_product_editor_spotlight_tell_me_more_click"):(0,c.recordEvent)("block_product_editor_spotlight_dismissed",{current_page:e+1}),d(!1),u()}});if(t){const{heading:e,description:t}={heading:a?(0,s.__)("Meet the product editing form","woocommerce"):(0,s.__)("Welcome to the new product form!","woocommerce"),description:a?(0,s.__)("Discover the product form's unique features with a quick overview of what's included.","woocommerce"):(0,s.__)("Discover its new features and improvements with a quick overview of what's included.","woocommerce")};return(0,n.createElement)(g.TourKit,{config:{steps:[{meta:{name:"woocommerce-block-editor-tour",primaryButton:{text:(0,s.__)("View highlights","woocommerce")},descriptions:{desktop:t},heading:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("span",null,e),(0,n.createElement)(g.Pill,null,(0,s.__)("Beta","woocommerce")))},referenceElements:{desktop:"#adminmenuback"}}],closeHandler:(e,t,n)=>{"done-btn"===n?((0,c.recordEvent)("block_product_editor_spotlight_view_highlights"),d(!0)):(o(),(0,c.recordEvent)("block_product_editor_spotlight_dismissed",{current_page:0}),u())},options:{effects:{arrowIndicator:!1,overlay:!1,liveResize:{rootElementSelector:"#adminmenuback",resize:!0}},portalParentElement:document.getElementById("wpbody"),popperModifiers:[{name:"bottom-left",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:e=>{let{state:t}=e;t.styles.popper.top="auto",t.styles.popper.left="auto",t.styles.popper.bottom="10px",t.styles.popper.transform="translate3d(10px, 0px, 0px)"}}],classNames:"woocommerce-block-editor-tourkit"}}})}return null};var b=o(67221);const k="woocommerce_block_product_tour_shown",v=()=>{const e=(()=>{const{updateOptions:e}=(0,l.useDispatch)(b.OPTIONS_STORE_NAME),{shouldTourBeShown:t}=(0,l.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(b.OPTIONS_STORE_NAME);return{shouldTourBeShown:!("yes"===t(k)||!o("getOption",[k]))}}));return{dismissModal:()=>{e({[k]:"yes"})},shouldTourBeShown:t}})();return(0,n.createElement)(f,e)};function y(){const{productId:e}=(0,i.UO)(),t=function(e){const{saveEntityRecord:t}=(0,l.useDispatch)("core"),[o,c]=(0,n.useState)(void 0);return(0,n.useEffect)((()=>{(e?(0,l.resolveSelect)("core").getEntityRecord("postType","product",Number.parseInt(e,10)):t("postType","product",{title:r.AUTO_DRAFT_NAME,status:"auto-draft"})).then((e=>{c(e)})).catch((e=>{throw c(void 0),e}))}),[e]),o}(e);return(0,n.useEffect)((()=>(0,r.__experimentalInitBlocks)()),[]),(0,n.useEffect)((function(){e?(0,c.recordEvent)("product_edit_view",{source:r.TRACKS_SOURCE,product_id:e}):(0,c.recordEvent)("product_add_view",{source:r.TRACKS_SOURCE})}),[e]),null!=t&&t.id?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(r.__experimentalEditor,{product:t,settings:productBlockEditorSettings||{}}),(0,n.createElement)(v,null)):(0,n.createElement)(a.Spinner,null)}(0,r.productApiFetchMiddleware)()},90495:(e,t,o)=>{o.d(t,{Z:()=>_});var n=o(69307),r=o(65736),c=o(83849),a=o.n(c),i=o(55609),l=o(70444);const s=e=>{let{isSelected:t}=e;return(0,n.createElement)(l.SVG,{width:"8",height:"8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)(l.Circle,{cx:"4",cy:"4",r:"4",fill:t?"#419ECD":"#E1E3E6"}))};function d(e){let{currentPage:t,numberOfPages:o,setCurrentPage:c}=e;return(0,n.createElement)("ul",{className:"components-guide__page-control","aria-label":(0,r.__)("Guide controls","woocommerce")},Array.from({length:o}).map(((e,a)=>(0,n.createElement)("li",{key:a,"aria-current":a===t?"step":void 0},(0,n.createElement)(i.Button,{key:a,icon:(0,n.createElement)(s,{isSelected:a===t}),"aria-label":(0,r.sprintf)((0,r.__)("Page %1$d of %2$d","woocommerce"),a+1,o),onClick:()=>c(a)})))))}const u=function(e){let{className:t,contentLabel:o,finishButtonText:c=(0,r.__)("Finish","woocommerce"),finishButtonLink:l,onFinish:s,pages:u=[]}=e;const m=(0,n.useRef)(null),[p,_]=(0,n.useState)(0),h=p>0,g=p<u.length-1,w=()=>{h&&_(p-1)},E=()=>{g&&_(p+1)};return 0===u.length?null:(0,n.createElement)(i.Modal,{className:a()("components-guide",t),title:o,onRequestClose:()=>{s(p,"close")},onKeyDown:e=>{"ArrowLeft"===e.code?(w(),e.preventDefault()):"ArrowRight"===e.code&&(E(),e.preventDefault())},ref:m},(0,n.createElement)("div",{className:"components-guide__container"},(0,n.createElement)("div",{className:"components-guide__page"},u[p].image,u.length>1&&(0,n.createElement)(d,{currentPage:p,numberOfPages:u.length,setCurrentPage:_}),u[p].content),(0,n.createElement)("div",{className:"components-guide__footer"},h&&(0,n.createElement)(i.Button,{className:"components-guide__back-button",variant:"tertiary",onClick:w},(0,r.__)("Previous","woocommerce")),g&&(0,n.createElement)(i.Button,{className:"components-guide__forward-button",variant:"primary",onClick:E},(0,r.__)("Next","woocommerce")),!g&&(0,n.createElement)(i.Button,{className:"components-guide__finish-button",variant:"primary",href:l,target:l?"_blank":void 0,rel:l?"noopener":void 0,onClick:()=>s(p,"finish")},c))))},m=e=>{let{page:t}=e;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("h1",{className:"woocommerce-block-editor-guide__heading"},t.heading),(0,n.createElement)("p",{className:"woocommerce-block-editor-guide__text"},t.text))},p=e=>{let{page:t}=e;return(0,n.createElement)("div",{className:`woocommerce-block-editor-guide__header woocommerce-block-editor-guide__header-${t.index+1}`})},_=e=>{let{onCloseGuide:t}=e;const o=[{heading:(0,r.__)("Fresh and modern interface","woocommerce"),text:(0,r.__)("Everything you need to create and sell your products, all in one place. From photos and descriptions to pricing and inventory, all of your product settings can be found here.","woocommerce")},{heading:(0,r.__)("Content-rich product descriptions","woocommerce"),text:(0,r.__)("Show off what's great about your products and engage your customers with content-rich product descriptions. Add images, videos, and any other content they might need to make a purchase.","woocommerce")},{heading:(0,r.__)("Lightning fast performance ","woocommerce"),text:(0,r.__)("Get your products listed and available for purchase in no time! Our modern technology ensures a reliable and streamlined experience.","woocommerce")},{heading:(0,r.__)("More features are on the way","woocommerce"),text:(0,r.__)("We're actively working on adding more features to the product form, including the ability to add digital products, variations, and more. Watch this space!","woocommerce")}].map(((e,t)=>({content:(0,n.createElement)(m,{page:e}),image:(0,n.createElement)(p,{page:{...e,index:t}})})));return(0,n.createElement)(u,{className:"woocommerce-block-editor-guide",contentLabel:"",finishButtonText:(0,r.__)("Tell me more","woocommerce"),finishButtonLink:"https://woocommerce.com/product-form-beta",onFinish:t,pages:o})}},65545:(e,t,o)=>{o.d(t,{E:()=>a});var n=o(67221),r=o(9818);const c={status:"publish",_fields:["id"]},a=()=>(0,r.useSelect)((e=>{const{getProductsTotalCount:t,hasFinishedResolution:o}=e(n.PRODUCTS_STORE_NAME),r=t(c,0);return{publishedProductsCount:r,loadingPublishedProductsCount:!o("getProductsTotalCount",[c,0]),isNewUser:r<1}}))}}]);